﻿Public Class PlugIn
    Dim CodeEdit As TextBoxPrj.CodeEditor
    Sub New(ByVal mCodeEditor As TextBoxPrj.CodeEditor)
        CodeEdit = mCodeEditor
    End Sub
    Public Function GetToolStripMenuItem() As System.Collections.Generic.List(Of System.Windows.Forms.ToolStripMenuItem)
        Dim ToolStripMenuItemArray As New List(Of System.Windows.Forms.ToolStripMenuItem)
        Dim menu_CreateCopy As New ToolStripMenuItem
        menu_CreateCopy.Text = "データ定義"
        AddHandler menu_CreateCopy.Click, AddressOf OpenCreate
        ToolStripMenuItemArray.Add(menu_CreateCopy)

        Dim menu_InsertPIC As New ToolStripMenuItem
        menu_InsertPIC.Text = "PIC定義"
        AddHandler menu_InsertPIC.Click, AddressOf OpenPIC
        ToolStripMenuItemArray.Add(menu_InsertPIC)

        Dim menu_KeyWord As New ToolStripMenuItem
        menu_KeyWord.Text = "キーワード検索"
        AddHandler menu_KeyWord.Click, AddressOf KeyWord
        ToolStripMenuItemArray.Add(menu_KeyWord)

        Dim menu_About As New ToolStripMenuItem
        menu_About.Text = "ツールについて"
        AddHandler menu_About.Click, AddressOf About
        ToolStripMenuItemArray.Add(menu_About)

        Return ToolStripMenuItemArray
    End Function
    Sub OpenCreate()
        Using mForm As New frmCreateCopyFile(CodeEdit)
            mForm.ShowDialog()
        End Using
    End Sub
    Sub OpenPIC()
        Using mForm As New frmPICGenerate(CodeEdit)
            mForm.ShowDialog()
        End Using
    End Sub
    Sub KeyWord()
        Using mForm As New frmKeyWord(CodeEdit.MainDocument.GetSelectionText)
            mForm.ShowDialog()
        End Using
    End Sub
    Sub About()
        Using mForm As New frmAbout
            mForm.ShowDialog()
        End Using
    End Sub
    Public Function GetContextMenuItem() As System.Collections.Generic.List(Of System.Windows.Forms.ToolStripMenuItem)
        Dim ToolStripMenuItemArray As New List(Of System.Windows.Forms.ToolStripMenuItem)
        Dim menu_KeyWord As New ToolStripMenuItem
        menu_KeyWord.Text = "キーワード検索"
        AddHandler menu_KeyWord.Click, AddressOf KeyWord
        ToolStripMenuItemArray.Add(menu_KeyWord)
        Return ToolStripMenuItemArray
    End Function
    Public Function GetPlugInName() As String
        Return "COBOL"
    End Function
End Class
